<template>
  <div id="test"></div>
  <a-form ref="form"></a-form>
  <div>{{ count }}</div>
  <a-button @click="goPage">点击跳转</a-button>
</template>
,

<script setup>
import { onMounted, ref, onBeforeUnmount } from 'vue'
import { useRouter } from 'vue-router'
const test = document.getElementById('test')
const form = ref()

console.log(test)
console.log(form.value)
const count = ref(1)
const router = useRouter()
const goPage = () => {
  router.push({ name: 'pasture' })
}

// 每1000毫秒  执行一次里面的函数
// const timerId = setInterval(() => {
//   count.value = count.value + 1
//   console.log(count.value)
// }, 1000)

// 过1000毫秒后，执行一次里面的函数
const timerId = setTimeout(() => {
  count.value = count.value + 1
}, 1000)

console.log(timerId)
debugger

onBeforeUnmount(() => {
  clearInterval(timerId)
  debugger
})

onMounted(() => {
  const test = document.getElementById('test')
  console.log(test)
  console.log(form.value)
})
</script>

<style lang="less" scoped></style>
